package com.lix.langrensha.service;

import com.lix.langrensha.contants.RoleConstant;
import com.lix.langrensha.contants.SkillConstant;
import com.lix.langrensha.model.RolePojo;
import com.lix.langrensha.model.SkillPojo;
import com.lix.langrensha.model.User;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * @Author lix
 * @create 2019/12/12-10:47
 * @description
 */
@Service
public class CreateRoleService {
    void createZhaDanRen(User user) {
        RolePojo pojo = new RolePojo();
        ArrayList<SkillPojo> skillPojos = new ArrayList<>();
        SkillPojo skillPojo1 = new SkillPojo();
        pojo.setRoleId(RoleConstant.ZHA_DAN_REN.getRoleId());
        pojo.setRoleName(RoleConstant.ZHA_DAN_REN.getRoleName());
        skillPojo1.setSkillId(SkillConstant.ZI_BAO.getSkillId());
        skillPojo1.setSkillName(SkillConstant.ZI_BAO.getSkillName());
        skillPojo1.setNum(1);
        skillPojos.add(skillPojo1);
        pojo.setSkill(skillPojos);
        user.setRole(pojo);
    }

    void createLieRen(User user) {
        RolePojo pojo = new RolePojo();
        ArrayList<SkillPojo> skillPojos = new ArrayList<>();
        SkillPojo skillPojo1 = new SkillPojo();
        pojo.setRoleId(RoleConstant.LIE_REN.getRoleId());
        pojo.setRoleName(RoleConstant.LIE_REN.getRoleName());
        skillPojo1.setSkillId(SkillConstant.SHE_JI.getSkillId());
        skillPojo1.setSkillName(SkillConstant.SHE_JI.getSkillName());
        skillPojo1.setNum(1);
        skillPojos.add(skillPojo1);
        pojo.setSkill(skillPojos);
        user.setRole(pojo);
    }

    void createShouWei(User user) {
        RolePojo pojo = new RolePojo();
        ArrayList<SkillPojo> skillPojos = new ArrayList<>();
        SkillPojo skillPojo1 = new SkillPojo();
        pojo.setRoleId(RoleConstant.SHOU_WEI.getRoleId());
        pojo.setRoleName(RoleConstant.SHOU_WEI.getRoleName());
        skillPojo1.setSkillId(SkillConstant.SHOU_HU.getSkillId());
        skillPojo1.setSkillName(SkillConstant.SHOU_HU.getSkillName());
        skillPojo1.setNum(1);
        skillPojos.add(skillPojo1);
        pojo.setSkill(skillPojos);
        user.setRole(pojo);
    }

    void createYuYanJia(User user) {
        RolePojo pojo = new RolePojo();
        ArrayList<SkillPojo> skillPojos = new ArrayList<>();
        SkillPojo skillPojo1 = new SkillPojo();
        pojo.setRoleId(RoleConstant.YU_YAN_JIA.getRoleId());
        pojo.setRoleName(RoleConstant.YU_YAN_JIA.getRoleName());
        skillPojo1.setSkillId(SkillConstant.YU_YAN.getSkillId());
        skillPojo1.setSkillName(SkillConstant.YU_YAN.getSkillName());
        skillPojo1.setNum(1);
        skillPojos.add(skillPojo1);
        pojo.setSkill(skillPojos);
        user.setRole(pojo);
    }

    void createNvWu(User user) {
        RolePojo pojo = new RolePojo();
        ArrayList<SkillPojo> skillPojos = new ArrayList<>();
        SkillPojo skillPojo1 = new SkillPojo();
        SkillPojo skillPojo2 = new SkillPojo();
        pojo.setRoleId(RoleConstant.NV_WU.getRoleId());
        pojo.setRoleName(RoleConstant.NV_WU.getRoleName());
        skillPojo1.setSkillId(SkillConstant.JIE_YAO.getSkillId());
        skillPojo1.setSkillName(SkillConstant.JIE_YAO.getSkillName());
        skillPojo2.setSkillId(SkillConstant.DU_YAO.getSkillId());
        skillPojo2.setSkillName(SkillConstant.DU_YAO.getSkillName());
        skillPojo1.setNum(1);
        skillPojo2.setNum(1);
        skillPojos.add(skillPojo1);
        skillPojos.add(skillPojo2);
        pojo.setSkill(skillPojos);
        user.setRole(pojo);
    }

    void createLangRen(User user) {
        RolePojo langRen = new RolePojo();
        ArrayList<SkillPojo> skillPojos = new ArrayList<>(2);
        SkillPojo skillPojo2 = new SkillPojo();
        langRen.setRoleId(RoleConstant.LANG_REN.getRoleId());
        langRen.setRoleName(RoleConstant.LANG_REN.getRoleName());
        skillPojo2.setSkillId(SkillConstant.SHA.getSkillId());
        skillPojo2.setSkillName(SkillConstant.SHA.getSkillName());
        skillPojo2.setNum(1);
        skillPojos.add(skillPojo2);
        langRen.setSkill(skillPojos);
        user.setRole(langRen);
    }

    void createPingMin(User user) {
        RolePojo pingMin = new RolePojo();
        ArrayList<SkillPojo> skillPojos = new ArrayList<>();
        pingMin.setRoleId(RoleConstant.PING_MIN.getRoleId());
        pingMin.setRoleName(RoleConstant.PING_MIN.getRoleName());
        pingMin.setSkill(skillPojos);
        user.setRole(pingMin);
    }

    void createYinLang(User user) {
        RolePojo yinLang = new RolePojo();
        ArrayList<SkillPojo> skillPojos = new ArrayList<>();
        SkillPojo skillPojo = new SkillPojo();
        yinLang.setRoleId(RoleConstant.YIN_LANG.getRoleId());
        yinLang.setRoleName(RoleConstant.YIN_LANG.getRoleName());
        skillPojo.setSkillId(SkillConstant.SHA.getSkillId());
        skillPojo.setSkillName(SkillConstant.SHA.getSkillName());
        skillPojo.setNum(0);
        skillPojos.add(skillPojo);
        yinLang.setSkill(skillPojos);
        user.setRole(yinLang);
    }

    /**
     * 白痴角色
     * @param user
     */
    public void createBaiChi(User user) {
        RolePojo baiChi = new RolePojo();
        ArrayList<SkillPojo> skillPojos = new ArrayList<>();
        SkillPojo skillPojo = new SkillPojo();
        baiChi.setRoleId(RoleConstant.BAI_CHI.getRoleId());
        baiChi.setRoleName(RoleConstant.BAI_CHI.getRoleName());
        skillPojos.add(skillPojo);
        baiChi.setSkill(skillPojos);
        user.setRole(baiChi);
    }

    /**
     * 熊角色
     * @param user
     */
    public void createXiong(User user) {
        RolePojo xiong = new RolePojo();
        ArrayList<SkillPojo> skillPojos = new ArrayList<>();
        SkillPojo skillPojo = new SkillPojo();
        xiong.setRoleId(RoleConstant.XIONG.getRoleId());
        xiong.setRoleName(RoleConstant.XIONG.getRoleName());
        skillPojos.add(skillPojo);
        xiong.setSkill(skillPojos);
        user.setRole(xiong);
    }
    /**
     * 广播通知
     *
     * @param roomStatus
     * @return
     * @
     */
//    public void broadcast(int status, String target)  {
//        String message = "";
//        switch (status) {
//            case 1:
//                message = ProcessConstant.BAI_TIAN.getMessage();
//                break;
//            case 2:
//                message = ProcessConstant.HEI_YE.getMessage();
//                break;
//            case 3:
//                message = ProcessConstant.PING_AN_YE.getMessage();
//                break;
//            case 4:
//                message = ProcessConstant.TIAN_LIANG.getMessage();
//                break;
//            case 5:
//                message = ProcessConstant.FA_YAN.getMessage();
//                break;
//            case 6:
//                message = ProcessConstant.TOU_PIAO.getMessage();
//                break;
//            case 7:
//                message = ProcessConstant.CHU_JUE.getMessage(target);
//                break;
//            case 8:
//                message = ProcessConstant.BI_YAN.getMessage();
//                break;
//            case 9:
//                message = ProcessConstant.LANG_REN_ZHENG_YAN.getMessage();
//                break;
//            case 10:
//                message = ProcessConstant.YU_YAN_JIA_ZHENG_YAN.getMessage();
//                break;
//            case 11:
//                message = ProcessConstant.NV_WU_ZHENG_YAN.getMessage();
//                break;
//            case 12:
//                message = ProcessConstant.SHOU_WEI_ZHENG_YAN.getMessage();
//                break;
//            case 13:
//                message = ProcessConstant.JIA_RU_FANG_JIAN.getMessage(target);
//                break;
//            case 14:
//                message = ProcessConstant.FANG_JIAN_REN_SHU.getMessage(target);
//                break;
//            default:
//                ;
//        }
//        sendToMessage("all", message);
//    }


    /**
     * 广播通知
     *
     * @param userId
     * @param message
     * @throws InterruptedException
     */
//    private void sendToMessage(String userId, String message) throws InterruptedException {
//        template.convertAndSendToUser(userId, "/ptp", message);
//    }
}
